﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
namespace EC21_EDiamond.Admin
{
    public partial class LoginAdmin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["admin"] != null)
            {
                Session["admin"] = null;
            }
        }

        protected void btnDangNhap_Click(object sender, EventArgs e)
        {
            if (Membership.ValidateUser(txtUser.Text, txtPass.Text) == true)
            {
                Roles.DeleteCookie();
                Session["admin"] = txtUser.Text;
                FormsAuthentication.RedirectFromLoginPage(txtUser.Text, true);
            }
            else
            {
                lblThongBao.Text = "Tài Khoản hoặc Mật Khẩu Không Đúng!";
            }
        }
    }
}